/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.jm.financeiro.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

/**
 *
 * @author joao
 */
@Entity
@Table(name = "diagnostico", catalog = "salao", schema = "public")
@NamedQueries({
    @NamedQuery(name = "Diagnostico.findAll", query = "SELECT d FROM Diagnostico d")})
public class Diagnostico implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "diagnostico_id_diagnostico_seq")
    @SequenceGenerator(name = "diagnostico_id_diagnostico_seq", sequenceName = "diagnostico_id_diagnostico_seq", initialValue = 1, allocationSize = 1)
    @Basic(optional = false)
    @Column(name = "id_diagnostico", nullable = false)
    private Integer idDiagnostico;
    @Size(max = 100)
    @Column(name = "dsc_diagnostico", length = 100)
    private String dscDiagnostico;
    
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idDiagnostico")
    @LazyCollection(LazyCollectionOption.FALSE)
    @org.hibernate.annotations.Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
    private List<DiagnosticoNivel1> diagnosticoNivel1List;

    public Diagnostico() {
    }

    public Diagnostico(Integer idDiagnostico) {
        this.idDiagnostico = idDiagnostico;
    }

    public Integer getIdDiagnostico() {
        return idDiagnostico;
    }

    public void setIdDiagnostico(Integer idDiagnostico) {
        this.idDiagnostico = idDiagnostico;
    }

    public String getDscDiagnostico() {
        return dscDiagnostico;
    }

    public void setDscDiagnostico(String dscDiagnostico) {
        this.dscDiagnostico = dscDiagnostico;
    }

    public List<DiagnosticoNivel1> getDiagnosticoNivel1List() {
        return diagnosticoNivel1List;
    }

    public void setDiagnosticoNivel1List(List<DiagnosticoNivel1> diagnosticoNivel1List) {
        this.diagnosticoNivel1List = diagnosticoNivel1List;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idDiagnostico != null ? idDiagnostico.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Diagnostico)) {
            return false;
        }
        Diagnostico other = (Diagnostico) object;
        if ((this.idDiagnostico == null && other.idDiagnostico != null) || (this.idDiagnostico != null && !this.idDiagnostico.equals(other.idDiagnostico))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.jm.financeiro.entity.Diagnostico[ idDiagnostico=" + idDiagnostico + " ]";
    }
    
}
